import { get } from "jquery";

const prefixWeather: string = "/api/weather";
const prefixFlash: string = "/api/flash";

// <china dn="day">
// <city quName="黑龙江" pyName="heilongjiang" cityname="哈尔滨" state1="0" state2="1" stateDetailed="晴转多云" tem1="5" tem2="-4" windState="小于"/>
// <city quName="吉林" pyName="jilin" cityname="长春" state1="1" state2="1" stateDetailed="多云" tem1="7" tem2="1" windState="西风3-4级"/>
// <city quName="辽宁" pyName="liaoning" cityname="沈阳" state1="0" state2="0" stateDetailed="晴" tem1="9" tem2="1" windState="西南风转南风3-4级"/>
// <city quName="海南" pyName="hainan" cityname="海口" state1="1" state2="1" stateDetailed="多云" tem1="25" tem2="18" windState="微风"/>
// <city quName="内蒙古" pyName="neimenggu" cityname="呼和浩特" state1="0" state2="0" stateDetailed="晴" tem1="20" tem2="3" windState="小于"/>
// <city quName="新疆" pyName="xinjiang" cityname="乌鲁木齐" state1="0" state2="0" stateDetailed="晴" tem1="24" tem2="11" windState="微风"/>
// <city quName="西藏" pyName="xizang" cityname="拉萨" state1="1" state2="2" stateDetailed="多云转阴" tem1="21" tem2="7" windState="微风"/>
// <city quName="青海" pyName="qinghai" cityname="西宁" state1="0" state2="0" stateDetailed="晴" tem1="18" tem2="1" windState="小于"/>
// <city quName="宁夏" pyName="ningxia" cityname="银川" state1="0" state2="0" stateDetailed="晴" tem1="25" tem2="6" windState="西北风3-4级转微风"/>
// <city quName="甘肃" pyName="gansu" cityname="兰州" state1="0" state2="29" stateDetailed="晴转浮尘" tem1="25" tem2="6" windState="小于"/>
// <city quName="河北" pyName="hebei" cityname="石家庄" state1="1" state2="0" stateDetailed="多云转晴" tem1="15" tem2="6" windState="小于"/>
// <city quName="河南" pyName="henan" cityname="郑州" state1="0" state2="0" stateDetailed="晴" tem1="23" tem2="10" windState="东北风3-4级"/>
// <city quName="湖北" pyName="hubei" cityname="武汉" state1="0" state2="0" stateDetailed="晴" tem1="26" tem2="13" windState="小于"/>
// <city quName="湖南" pyName="hunan" cityname="长沙" state1="0" state2="0" stateDetailed="晴" tem1="27" tem2="13" windState="小于"/>
// <city quName="山东" pyName="shandong" cityname="济南" state1="1" state2="2" stateDetailed="多云转阴" tem1="20" tem2="8" windState="小于"/>
// <city quName="江苏" pyName="jiangsu" cityname="南京" state1="0" state2="1" stateDetailed="晴转多云" tem1="26" tem2="13" windState="小于"/>
// <city quName="安徽" pyName="anhui" cityname="合肥" state1="1" state2="0" stateDetailed="多云转晴" tem1="26" tem2="11" windState="小于"/>
// <city quName="山西" pyName="shanxi" cityname="太原" state1="0" state2="0" stateDetailed="晴" tem1="20" tem2="5" windState="小于"/>
// <city quName="陕西" pyName="sanxi" cityname="西安" state1="0" state2="0" stateDetailed="晴" tem1="30" tem2="13" windState="小于"/>
// <city quName="四川" pyName="sichuan" cityname="成都" state1="1" state2="1" stateDetailed="多云" tem1="22" tem2="12" windState="微风"/>
// <city quName="云南" pyName="yunnan" cityname="昆明" state1="7" state2="7" stateDetailed="小雨" tem1="16" tem2="9" windState="小于"/>
// <city quName="贵州" pyName="guizhou" cityname="贵阳" state1="2" state2="0" stateDetailed="阴转晴" tem1="17" tem2="9" windState="小于"/>
// <city quName="浙江" pyName="zhejiang" cityname="杭州" state1="2" state2="2" stateDetailed="阴" tem1="24" tem2="11" windState="微风"/>
// <city quName="福建" pyName="fujian" cityname="福州" state1="1" state2="0" stateDetailed="多云转晴" tem1="23" tem2="14" windState="微风"/>
// <city quName="江西" pyName="jiangxi" cityname="南昌" state1="0" state2="0" stateDetailed="晴" tem1="25" tem2="15" windState="小于"/>
// <city quName="广东" pyName="guangdong" cityname="广州" state1="0" state2="0" stateDetailed="晴" tem1="30" tem2="17" windState="微风"/>
// <city quName="广西" pyName="guangxi" cityname="南宁" state1="1" state2="1" stateDetailed="多云" tem1="28" tem2="19" windState="小于"/>
// <city quName="北京" pyName="beijing" cityname="北京" state1="1" state2="0" stateDetailed="多云转晴" tem1="14" tem2="4" windState="小于"/>
// <city quName="天津" pyName="tianjin" cityname="天津" state1="2" state2="1" stateDetailed="阴转多云" tem1="11" tem2="4" windState="小于"/>
// <city quName="上海" pyName="shanghai" cityname="上海" state1="2" state2="1" stateDetailed="阴转多云" tem1="24" tem2="13" windState="小于"/>
// <city quName="重庆" pyName="chongqing" cityname="重庆" state1="2" state2="1" stateDetailed="阴转多云" tem1="22" tem2="12" windState="小于"/>
// <city quName="香港" pyName="xianggang" cityname="香港" state1="0" state2="0" stateDetailed="晴" tem1="28" tem2="19" windState="微风"/>
// <city quName="澳门" pyName="aomen" cityname="澳门" state1="0" state2="1" stateDetailed="晴转多云" tem1="27" tem2="19" windState="微风"/>
// <city quName="台湾" pyName="taiwan" cityname="台北" state1="7" state2="1" stateDetailed="小雨转多云" tem1="22" tem2="19" windState="东风3-4级"/>
// <city quName="西沙" pyName="xisha" cityname="西沙" state1="1" state2="1" stateDetailed="多云" tem1="29" tem2="25" windState="东北风5-6级转4-5级"/>
// <city quName="南沙" pyName="nanshadao" cityname="南沙" state1="4" state2="4" stateDetailed="雷阵雨" tem1="31" tem2="27" windState="东北风4-5级"/>
// <city quName="钓鱼岛" pyName="diaoyudao" cityname="钓鱼岛" state1="0" state2="1" stateDetailed="晴转多云" tem1="25" tem2="22" windState="东北风3-4级"/>
// </china>
export const getProvinceOfChina = () =>
  get(prefixFlash + "/wmaps/xml/china.xml");

// <jiangsu dn="day">
// <city cityX="119.25" cityY="139.85" cityname="徐州" centername="徐州" fontColor="FFFFFF" pyName="xuzhou" state1="8" state2="1" stateDetailed="中雨转多云" tem1="25" tem2="11" temNow="24" windState="小于" windDir="东南风" windPower="1级" humidity="47%" time="15:00" url="101190801"/>
// <city cityX="267" cityY="90" cityname="连云港" centername="连云港" fontColor="FFFFFF" pyName="lianyungang" state1="1" state2="4" stateDetailed="多云转雷阵雨" tem1="17" tem2="9" temNow="11" windState="东北风4-5级转3-4级" windDir="东北风" windPower="4级" humidity="83%" time="15:00" url="101191001"/>
// <city cityX="227" cityY="175" cityname="宿迁" centername="宿迁" fontColor="FFFFFF" pyName="suqian" state1="7" state2="1" stateDetailed="小雨转多云" tem1="24" tem2="12" temNow="23" windState="小于" windDir="东北风" windPower="3级" humidity="58%" time="15:00" url="101191301"/>
// <city cityX="279" cityY="190" cityname="淮安" centername="淮安" fontColor="FFFFFF" pyName="huaian" state1="1" state2="7" stateDetailed="多云转小雨" tem1="26" tem2="11" temNow="24" windState="小于" windDir="西风" windPower="3级" humidity="43%" time="15:00" url="101190901"/>
// <city cityX="360" cityY="169" cityname="盐城" centername="盐城" fontColor="FFFFFF" pyName="yancheng" state1="1" state2="1" stateDetailed="多云" tem1="24" tem2="10" temNow="24" windState="小于" windDir="西南风" windPower="2级" humidity="34%" time="15:00" url="101190701"/>
// <city cityX="318.7" cityY="294.85" cityname="扬州" centername="扬州" fontColor="FFFFFF" pyName="yangzhou" state1="1" state2="1" stateDetailed="多云" tem1="27" tem2="14" temNow="26" windState="小于" windDir="东南风" windPower="2级" humidity="28%" time="15:00" url="101190601"/>
// <city cityX="366" cityY="269" cityname="泰州" centername="泰州" fontColor="FFFFFF" pyName="taizhou" state1="1" state2="1" stateDetailed="多云" tem1="25" tem2="11" temNow="25" windState="小于" windDir="东南风" windPower="2级" humidity="33%" time="15:00" url="101191201"/>
// <city cityX="278" cityY="343" cityname="南京" centername="南京" fontColor="FFFF00" pyName="nanjing" state1="0" state2="1" stateDetailed="晴转多云" tem1="26" tem2="13" temNow="25" windState="小于" windDir="东南风" windPower="2级" humidity="29%" time="15:00" url="101190101"/>
// <city cityX="328" cityY="339" cityname="镇江" centername="镇江" fontColor="FFFFFF" pyName="zhenjiang" state1="1" state2="1" stateDetailed="多云" tem1="26" tem2="12" temNow="25" windState="小于" windDir="东南风" windPower="2级" humidity="25%" time="15:00" url="101190301"/>
// <city cityX="450" cityY="297" cityname="南通" centername="南通" fontColor="FFFFFF" pyName="nantong" state1="1" state2="1" stateDetailed="多云" tem1="24" tem2="11" temNow="24" windState="小于" windDir="东南风" windPower="2级" humidity="30%" time="15:00" url="101190501"/>
// <city cityX="338" cityY="380" cityname="常州" centername="常州" fontColor="FFFFFF" pyName="changzhou" state1="0" state2="1" stateDetailed="晴转多云" tem1="26" tem2="13" temNow="暂无实况" windState="小于" windDir="暂无实况" windPower="暂无实况" humidity="暂无实况" time=":" url="101191101"/>
// <city cityX="400" cityY="386" cityname="无锡" centername="无锡" fontColor="FFFFFF" pyName="wuxi" state1="1" state2="1" stateDetailed="多云" tem1="25" tem2="12" temNow="25" windState="小于" windDir="东北风" windPower="2级" humidity="25%" time="15:00" url="101190201"/>
// <city cityX="450" cityY="388" cityname="苏州" centername="苏州" fontColor="FFFFFF" pyName="suzhou" state1="0" state2="0" stateDetailed="晴" tem1="25" tem2="12" temNow="25" windState="东南风3-4级" windDir="东北风" windPower="2级" humidity="23%" time="15:00" url="101190401"/>
// </jiangsu>
export const getCityCodeOfProvince = (pcode: string) =>
  get(prefixFlash + `/wmaps/xml/${pcode}.xml`);

export const getWeather = (cityCode: string) =>
  get(prefixWeather + `/data/sk/${cityCode}.html`);
